package cn.briarbear.myblog.controller;

import cn.briarbear.myblog.entity.table.About;
import cn.briarbear.myblog.enums.ViewConsts;
import cn.briarbear.myblog.service.IAboutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class AboutController {

    @Autowired
    private IAboutService aboutService;

//    @ModelAttribute
//    public About createAbout(){
//        return new About();
//    }

    @GetMapping("/about")
    public String getAbout(Model model) throws Exception {

        About about = aboutService.getAbout();
        model.addAttribute(ViewConsts.VIEW_ABOUT,about);
        return "abouts";
    }


}
